#ifndef XYACCOUNT_H
#define XYACCOUNT_H

#include <QObject>
#include <pjsua2/account.hpp>
#include "xycall.h"
#include <mutex>
#include <list>


class XyAccount : public QObject, public pj::Account
{
    Q_OBJECT
public:
    explicit XyAccount(QObject *parent = nullptr);

    void callState(XyCall* pcall,QVariantMap xyParam);
    void answer(XyCall* pCall);
    void makeCall(const QVariantMap& xyParam);
    void hangup(const QVariantMap& xyParam);
    void holdon(const QVariantMap& xyParam);
signals:


    // Account interface
public:
    virtual void onIncomingCall(pj::OnIncomingCallParam &prm) override;
    virtual void onRegState(pj::OnRegStateParam &prm) override;

    // Account interface
public:
    virtual void onRegStarted(pj::OnRegStartedParam &prm) override;
    virtual void onIncomingSubscribe(pj::OnIncomingSubscribeParam &prm) override;
    virtual void onInstantMessage(pj::OnInstantMessageParam &prm) override;
    virtual void onInstantMessageStatus(pj::OnInstantMessageStatusParam &prm) override;
    virtual void onTypingIndication(pj::OnTypingIndicationParam &prm) override;
    virtual void onMwiInfo(pj::OnMwiInfoParam &prm) override;
private:
    std::list<XyCall*> m_lstCall;
    std::mutex m_mutex;
};

#endif // XYACCOUNT_H
